package io.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.hutool.core.util.StrUtil;
import io.common.dao.AdoptionDao;
import io.common.dto.AdoptionDTO;
import io.common.entity.AdoptionEntity;
import io.common.service.AdoptionService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 领养表
 *
 * @author BS #
 * @since 1.0.0 2024-04-23
 */
@Service
public class AdoptionServiceImpl extends CrudServiceImpl<AdoptionDao, AdoptionEntity, AdoptionDTO> implements AdoptionService {

    @Override
    public QueryWrapper<AdoptionEntity> getWrapper(Map<String, Object> params) {
        String id = (String) params.get("id");
        QueryWrapper<AdoptionEntity> wrapper = new QueryWrapper<>();


        String city = (String) params.get("city");
        String status = (String) params.get("status");

        if (StrUtil.isNotBlank(city) && !"全部".equals(city)) {
            wrapper.eq("city", city); // Add an equality condition to the query wrapper
        }


        if (StrUtil.isNotBlank(status) && !"全部领养".equals(status)) {
            wrapper.eq("status", status);
        }




        return wrapper;
    }


}